//
//  LJHBaseImageView.m
//  HEARME
//
//  Created by mac on 16/3/2.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHBaseImageView.h"

@implementation LJHBaseImageView


-(instancetype) initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
            self.backgroundColor = [UIColor colorWithRed:0.333 green:0.332 blue:0.357 alpha:1.000];
        }
        else
        {
            self.backgroundColor = [UIColor colorWithWhite:0.923 alpha:1.000];
        }
        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    }
    
    return self;
}
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"changeColor" object:nil];
    [super dealloc];
}

-(void)changeColor:(NSNotification *)notifition
{
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"])
    {
        self.backgroundColor = [UIColor colorWithRed:0.333 green:0.332 blue:0.357 alpha:1.000];
        
    }
    else
    {
        self.backgroundColor = [UIColor colorWithWhite:0.923 alpha:1.000];
    }
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
